package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.zbg.MaintenanceStaffData;
import com.ruoyi.system.mapper.MaintenanceStaffDataMapper;
import com.ruoyi.system.service.MaintenanceStaffDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class MaintenanceStaffDataServiceImpl extends ServiceImpl<MaintenanceStaffDataMapper, MaintenanceStaffData> implements MaintenanceStaffDataService {

    @Autowired
    private MaintenanceStaffDataMapper maintenanceStaffDataMapper;

    @Transactional(rollbackFor = Exception.class)
    public void saveAll(List<MaintenanceStaffData> maintenanceStaffDataList) {
        for (MaintenanceStaffData data : maintenanceStaffDataList) {
            // 使用区县、年、月作为业务主键
            maintenanceStaffDataMapper.saveOrUpdate(data);
        }
    }
}